package net.towee.server.ftp.files;

import org.apache.ftpserver.ftplet.FtpFile;

/**
 * Attachment wrapper for ftp server
 * 
 * @author c58
 */
public abstract class AbstractFtpFile implements FtpFile {
	public enum FtpFileType {
		ROOT_NODE, TREE_NODE, DOCUMENT_NODE,

		DESCRIPTION, ATTACHMENT, PROFILE, DISCUSSION
	}

	protected final boolean isDir;
	protected final String name;
	protected final long size;
	protected final String groupName;
	protected final String ownerName;
	protected final FtpFileType type;
	protected final String path;

	public AbstractFtpFile(String name, boolean isDir, long size, String groupName, String ownerName,
			FtpFileType type, String path) {
		this.name = name;
		this.isDir = isDir;
		this.size = size;
		this.groupName = groupName;
		this.ownerName = ownerName;
		this.type = type;
		this.path = path;
	}

	@Override
	public String getAbsolutePath() {
		return path;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public boolean isHidden() {
		return false;
	}

	@Override
	public boolean isDirectory() {
		return isDir;
	}

	@Override
	public boolean isFile() {
		return !isDir;
	}

	@Override
	public boolean doesExist() {
		return true;
	}

	@Override
	public boolean isReadable() {
		return true;
	}

	@Override
	public boolean isWritable() {
		return false;
	}

	@Override
	public boolean isRemovable() {
		return false;
	}

	@Override
	public String getOwnerName() {
		return ownerName;
	}

	@Override
	public String getGroupName() {
		return groupName;
	}

	@Override
	public int getLinkCount() {
		return 0;
	}

	@Override
	public boolean setLastModified(long time) {
		return false;
	}

	@Override
	public long getSize() {
		return size;
	}

	@Override
	public boolean mkdir() {
		return false;
	}

	@Override
	public boolean delete() {
		return false;
	}

	@Override
	public boolean move(FtpFile destination) {
		return false;
	}
}
